package com.alexgaoyh.MutiModule.Dubbo.RWSeperate.consumer.web.aop;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.MutiModule.common.vo.TreeNode;
import com.alexgaoyh.MutiModule.Dubbo.RWSeperate.consumer.web.demo.util.TreeNodeUtilss;

@Aspect
public class LeftMenuDataAop {

	@Pointcut("within(com.alexgaoyh.MutiModule.Dubbo.RWSeperate.consumer.web.base.BaseController+ )")
	public void controller() {
		System.out.println("LeftMenuDataAop.controller");
	}
	
	@Around("controller()")  
    public Object leftMenuData(ProceedingJoinPoint point) throws Throwable{  
		
		HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		
		List<TreeNode> treeList = TreeNodeUtilss.generaterTreeNodeList2();
		request.setAttribute("treeList", treeList);
		
        System.out.println("================================================================");  
        return point.proceed();  
    }  

}
